package com.smcdd.cdb.dbo.cdb_dbo.ui.activity;

import android.widget.ImageView;
import android.widget.TextView;

import com.smcdd.cdb.dbo.cdb_dbo.R;
import com.smcdd.cdb.dbo.cdb_dbo.service.presenter.FirmwarePresenter;
import com.smcdd.cdb.dbo.cdb_dbo.service.view.IFirmware;
import com.smcdd.cdb.dbo.cdb_dbo.ui.base.BaseActivity;


/**
 * 作者：Administrator on 2017/7/11 12:47
 * 邮箱：zhanghuaiha@gmail.com
 * 更新固件
 */

public class FirmwareActivity extends BaseActivity<IFirmware,FirmwarePresenter> implements IFirmware{
    private ImageView one,two,three,back,four,five,six,seven;
    private TextView update,version;

    @Override
    public void initView() {
        one = (ImageView) findViewById(R.id.firmware_one);
        two = (ImageView) findViewById(R.id.firmware_two);
        three = (ImageView) findViewById(R.id.firmware_three);
        four = (ImageView) findViewById(R.id.firmware_four);
        five = (ImageView) findViewById(R.id.firmware_five);
        six = (ImageView) findViewById(R.id.firmware_six);
        back = (ImageView) findViewById(R.id.firmware_back);
        seven = (ImageView) findViewById(R.id.firmware_seven);
        update = (TextView) findViewById(R.id.firmware_update);
        version = (TextView) findViewById(R.id.firmware_version);
    }

    @Override
    public void initData() {
        String alias = getIntent().getStringExtra("alias");
        mPresenter.loadDate(alias);
    }

    @Override
    public void initListener() {
        update.setOnClickListener(v -> {
            mPresenter.getType(3);
            mPresenter.getCdb_info();
        });
        version.setOnClickListener(v -> {
            mPresenter.getType(2);
            mPresenter.getCdb_info();
        });
        back.setOnClickListener(v -> finish());
    }

    @Override
    protected FirmwarePresenter createPresenter() {
        return new FirmwarePresenter(this);
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_firmware;
    }

    @Override
    public ImageView getOne() {
        return one;
    }

    @Override
    public ImageView getTwo() {
        return two;
    }

    @Override
    public ImageView getThree() {
        return three;
    }

    @Override
    public ImageView getFour() {
        return four;
    }

    @Override
    public ImageView getFive() {
        return five;
    }

    @Override
    public ImageView getSix() {
        return six;
    }

    @Override
    public ImageView getSeven() {
        return seven;
    }
}
